package com.hxy.health.platform.controller;

import com.hxy.health.platform.pojo.Comment;
import com.hxy.health.platform.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class CommentController {
    @Autowired
    private CommentService commentService;
    /**
     * 添加评论
     */
    @RequestMapping("comment/addComment")
    public String addComment(Comment comment, ModelMap modelMap) {
        int result = commentService.addComment(comment);
        if (result >0) {
            return "redirect:/page/blogDetail?id=" + comment.getArticleId();
        }
        return "";
    }
}
